package com.gitee.cui.springcloud.controller;

import javax.annotation.Resource;

import com.gitee.cui.springcloud.entities.CommonResult;
import com.gitee.cui.springcloud.entities.Payment;
import com.gitee.cui.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022-03-06 13:58
 **/
@RestController
@Slf4j
@RequestMapping(value = "/consumer")
public class OrderFeignController {

	@Resource
	private PaymentFeignService paymentFeignService;

	@PostMapping("/payment/create")
	public CommonResult<Integer> create(@RequestBody Payment payment) {
		return paymentFeignService.create(payment);
	}

	@GetMapping(value = "/payment/get/{id}")
	public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
		return paymentFeignService.getPaymentById(id);
	}

	@GetMapping(value = "/payment/feign/timeout")
	public String feignTimeout() {
		return paymentFeignService.feignTimeout();
	}
}
